package org.example;

import org.example.service.OrderService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        OrderService orderService = context.getBean("orderService", OrderService.class);



        try {
            orderService.add("手机", 2);
        } catch (RuntimeException e) {
            System.out.println("add 操作被拦截：" + e.getMessage());
        }

        // delete 测试
        try {
            orderService.delete("电脑");
        } catch (RuntimeException e) {
            System.out.println("delete 操作被拦截：" + e.getMessage());
        }
        orderService.find("书籍");
    }
}
